import 'package:flutter/material.dart';
import 'package:flutter_rider/main/widgets/ext/u_layout.dart';
import 'package:flutter_rider/main/widgets/ext/u_text.dart';
import 'package:flutter_rider/main/widgets/ui_constant.dart';
import 'package:flutter_rider/utils/screen_fit.dart';
import 'package:flutter_svg/flutter_svg.dart';

///上面是image 下面是 Text
class ImageTextWidget extends StatelessWidget {
  String name;
  String imageName;
  Color? valueColor;
  VoidCallback? onTap;
  double ? pixel;

  ImageTextWidget(this.name, this.imageName, {this.valueColor,this.onTap, this.pixel, Key? key})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        SvgPicture.asset(imageName, width: pixel ?? 16.rpx, height: pixel ?? 16.rpx),
        UText.get(
          name,
          valueColor ?? UIColor.color_t14,
          12.rpx,
        ).padding(EdgeInsets.only(top: 8.rpx)),
      ],
    ).onTap(onTap);
  }
}
